package com.study.lxy.security;

import org.junit.Test;

import java.util.Scanner;

public class Test2 {

    public static void main(String[] args) throws Exception{
        Scanner sc = new Scanner(System.in);
        String line = sc.nextLine();
        String point = "ADWS";
        String steps[] = line.split(";");

        int x = 0,y = 0;
        for(String step : steps){
            // 判断是否是有效的操作
            if(step.length() <2 || step.length() > 3){
                continue;
            }
            String p = step.substring(0,1);
            String num = step.substring(1);
            try{
                int val = Integer.valueOf(num);
                if("A".equals(p)){
                    x -= val;
                } else if("D".equals(p)){
                    x += val;
                } else if("W".equals(p)){
                    y += val;
                } else if("S".equals(p)){
                    y -= val;
                } else {
                    continue;
                }
            } catch(Exception e){
                continue;
            }

        }
        System.out.println(x + "," + y);
    }

}
